package org.jeecg.modules.app.vo;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.node.INode;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 租车菜单
 * @Author: jeecg-boot
 * @Date:   2024-08-12
 * @Version: V1.0
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="app_menu对象", description="应用菜单")
public class MenuTreeVO implements INode {

    private static final long serialVersionUID = 1L;

    private String id;

    private String parentId;

    private List<INode> children = new ArrayList<>();

    /**客户端ID*/
    @Excel(name = "客户端ID", width = 15)
    @ApiModelProperty(value = "客户端ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long clientId;

    /**客户端ID*/
    @Excel(name = "客户端名称", width = 15)
    @ApiModelProperty(value = "客户端名称")
    @JsonSerialize(using = ToStringSerializer.class)
    private String clientName;

    /**菜单名称*/
    @Excel(name = "菜单名称", width = 15)
    @ApiModelProperty(value = "菜单名称")
    private String name;

    /**菜单编号*/
    @Excel(name = "菜单编号", width = 15)
    @ApiModelProperty(value = "菜单编号")
    private String code;

    private String key;

    private String value;

    private String title;

    /**
     * 是否有子孙节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Boolean hasChildren;

    @Override
    public List<INode> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }

}
